package com.uniapp.java.uniappjava.controller;

import com.uniapp.java.uniappjava.pojo.Author;
import com.uniapp.java.uniappjava.service.AuthorService;
import com.uniapp.java.uniappjava.utils.Result;
import com.uniapp.java.uniappjava.utils.UUIDUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lsy_server
 */
@RestController
@RequestMapping("author")
@Api(value = "作家")
public class AuthorController {
    @Autowired
    private AuthorService authorService;

    @PostMapping
    @ApiOperation(value = "开通作家身份 ", notes = "开通作家身份", produces = "application/json")
    public Result add(@RequestBody Author author) {
        author.setId(UUIDUtils.getId());
        authorService.save(author);
        return Result.ok(author);
    }

}
